package com.puppet.controller;

import com.puppet.constant.BaseController;
import com.puppet.constant.Result;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/user")
@CrossOrigin //解决跨域
public class UserController extends BaseController {
    //接受登录请求
    @PostMapping("/login")
    public Result doLogin(Map<String,String> map){
        System.out.println(map);
        return  this.toDataResult(map);
    }
    //拉取用户信息请求处理
    @GetMapping("/info")
    public  Result getInfo(String token){
        Map<String,String> mp = new HashMap<>();
        mp.put("roles","管理员");
        mp.put("name","Ding");
        mp.put("avatar","https://tse2-mm.cn.bing.net/th/id/OIP-C.-UuSAtM_GHACvgnxzzvj7AHaHa?w=207&h=208&c=7&r=0&o=5&dpr=1.5&pid=1.7");
        return  this.toDataResult(mp);
    }
}
